4bb3253d5070584c2589ca33eb9210e1d9339c76
[openwrt/openwrt.git] /
1 From d58ad77d5cc2a6d04db622a898e54d93fc7002a2 Mon Sep 17 00:00:00 2001
2 From: Kees Cook <kees@kernel.org>
3 Date: Mon, 10 Mar 2025 15:22:58 -0700
4 Subject: [PATCH] wifi: rtw88: Add __nonstring annotations for unterminated
5 strings
6
7 When a character array without a terminating NUL character has a static
8 initializer, GCC 15's -Wunterminated-string-initialization will only
9 warn if the array lacks the "nonstring" attribute[1]. Mark the arrays
10 with __nonstring to and correctly identify the char array as "not a C
11 string" and thereby eliminate the warning.
12
13 Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178 [1]
14 Cc: Ping-Ke Shih <pkshih@realtek.com>
15 Cc: Johannes Berg <johannes@sipsolutions.net>
16 Cc: linux-wireless@vger.kernel.org
17 Signed-off-by: Kees Cook <kees@kernel.org>
18 Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
19 Link: https://patch.msgid.link/20250310222257.work.866-kees@kernel.org
20 ---
21 drivers/net/wireless/realtek/rtw88/main.h | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
24 --- a/drivers/net/wireless/realtek/rtw88/main.h
25 +++ b/drivers/net/wireless/realtek/rtw88/main.h
26 @@ -835,7 +835,7 @@ struct rtw_vif {
27 };
28
29 struct rtw_regulatory {
30 - char alpha2[2];
31 + char alpha2[2] __nonstring;
32 u8 txpwr_regd_2g;
33 u8 txpwr_regd_5g;
34 };